<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
	request.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'cqm_zhuCe.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

		<style type="text/css">
<!--
.STYLE1 {
	color: #FF0000;
	font-size: 24px;
	font-weight: bold;
}

.STYLE2 {
	font-size: 12px
}
-->
</style>
	</head>

	<body>
		<div
			style="height: 55px; border: #FF0000 0px solid; margin: 0px; background: url(imgs/top_bg.jpg); background-repeat: no-repeat; margin: 0px 100px;">
			<div align="right" style="margin: 35px 55px auto; font-size: 14px">
				<a href="index.jsp">首页</a>
			</div>
		</div>
		<div
			style="border: #66CCFF 2px solid; background-color: #F9F9F9; margin: 0px 100px; width: 975px;">

			<div align="center" class="STYLE1" style="margin: 20px auto">
				新用户注册
			</div>
  

			<div style="background-color: #E2F2F3; margin: -8px 10px 5px 10px">
				<br>
				<br>
				<form action=" <%=basePath%>/servlet/CQM_ZhuCeServlet" method="post"
					onSubmit="return check()">
					<br>
					<br>

					<table border="0" align="center">
						<tr>
							<td width="107">
								&nbsp;
							</td>
							<td width="112">
								&nbsp;
							</td>
							<td width="311">
								&nbsp;
							</td>
							<td width="156">
								&nbsp;
							</td>
						</tr>
						<tr>
							<td height="38">
								&nbsp;
							</td>
							<td>
								<span class="STYLE2">用户名：</span>
							</td>
							<td colspan="2">
								<input type="text"
									style="background-color: #F9F9FB; width: 220px" name="name"
									id="name" />
								&nbsp;&nbsp;
								<input name="button" type="button" onClick="return change()"
									value="检查用户名是否已被注册" />
								<font id="div" style="font-size: 12px;"></font>
							</td>
						</tr>
						<tr>
							<td height="35">
								&nbsp;
							</td>
							<td>
								<span class="STYLE2">密码：</span>
							</td>
							<td colspan="2">
								<input type="text"
									style="background-color: #F9F9FB; width: 220px" name="pass"
									id="pass" />
								&nbsp;&nbsp;
								<span class="STYLE2">密码必须不少于六位</span>
							</td>
						</tr>
						<tr>
							<td height="42">
								&nbsp;
							</td>
							<td>
								<span class="STYLE2">重复密码：</span>
							</td>
							<td>
								<input type="text"
									style="background-color: #F9F9FB; width: 220px" name="pass1"
									id="pass1" />
							</td>
							<td>
								&nbsp;
							</td>
						</tr>
						<tr>
							<td height="42">
								&nbsp;
							</td>
							<td>
								<span class="STYLE2">E_mail:</span>
							</td>
							<td colspan="2">
								<input type="text"
									style="background-color: #F9F9FB; width: 260px" name="email"
									id="email" />
								&nbsp;
								<span class="STYLE2">&nbsp;请输入正确的邮政编码 </span>
							</td>
						</tr>
						<tr>
							<td>
								&nbsp;
							</td>
							<td>
								&nbsp;
							</td>
							<td>
								&nbsp;
							</td>
							<td>
								&nbsp;
							</td>
						</tr>
						<tr>
							<td height="23">
								&nbsp;
							</td>
							<td>
								&nbsp;
							</td>
							<td>
								<span class="STYLE2"><br /> </span>
								<div class="STYLE2">
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请查看并同意智联招聘用户协议：
								</div>
							</td>
							<td>
								&nbsp;
							</td>
						</tr>
						<tr>
							<td height="27">
								&nbsp;
							</td>
							<td>
								&nbsp;
							</td>
							<td>
								<span class="STYLE2"> <input type="checkbox"
										name="checkbox" id="checkbox" checked /> 我接受智联招聘的用户协议和隐私政策</span>
							</td>
							<td>
								&nbsp;
							</td>
						</tr>
						<tr>
							<td height="107" colspan="4">
								<div align="center">
									<input name="submit" type="submit" value="确定" />
								</div>
							</td>
						</tr>
						<tr>
							<td height="26" colspan="4">
								&nbsp;
							</td>
						</tr>
					</table>
					<div>
						<br>
				</form>
				<br>
				<br>
				<br>
				<br>
			</div>
			<br>


		</div>
		<div>
			<img src="imgs/top_1.gif" />
		</div>
		<br>
		<div style="border: #000000 solid 0px; margin: 5px">
			<table border="0" align="center">
				<tr>
					<td align="center">
						<span class="STYLE2">人才招聘 Email:xxx@qq.com 个人求职
							Email:xxx@.com 或垂询100-4567-100</span>
					</td>
				</tr>
				<tr>
					<td height="24" align="center">
						<span class="STYLE2">未经同意，不得转载本网站之所有招聘信息及作品 </span>
					</td>
				</tr>
				<tr>
					<td align="center">
						<span class="STYLE2">客服工作时间：8：00——17：00</span>
					</td>
				</tr>

				<tr>
					<td align="center">
						<img src="imgs/biaoshi.gif" />
					</td>
				</tr>
				<tr>
					<td align="center">
						<span class="STYLE2">4567工作网版权所有?2009-2019 </span>
					</td>
				</tr>

			</table>
		</div>

	</body>
</html>
<script>
function check()
{

   var name = document.getElementById('name').value;
   if(name =='')
		{
			alert("用户名不能为空");
			return false;
		}
   var divCheck=document.getElementById('div').innerHTML;
	 
	
		 if(divCheck=='')
	 {
	  alert("请进行检测");
	  return false;
	 }
	var pass= document.getElementById("pass").value;
	var pass1=document.getElementById("pass1").value;
	if(pass=='')
	{
		alert("密码不能为空");
		return false;
	}
	if(pass.length<6){
	 alert("密码不能少于6位");
		return false;
	  
	}
	if(pass1!=pass){
	 alert("两次输入的密码不相同");
	 return false;
	
	}
	
	
	var  email=document.getElementById('email').value;
	var email1 = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[com|cn|org|edu|gov])+/; 
	if(!email1.exec(email))
	{
		alert("您输入的邮件地址不正确,请重新输入");
			return false;
	}
	var ids = document.getElementById("checkbox");
	if(ids.checked){
	 
	return true;
	
	}
	else{
	alert("请您同意条款，才能进行注册");
	return false; }
	
	
	}
	</script>
<script src="./ajax.js"></script>
<script>
//用AJAX来验证用户名在数据库中是否存在如果存在就不让用户插入
function change()
{	
	 var name = document.getElementById('name').value;
	 if(name =='')
		{
			alert("用户名不能为空");
			return false;
		}
   var ajax = initAjax();
   var url = encodeURI('./cqm_checkName.jsp?name='+name+'&r='+ Math.random());
	ajax.open('get',url,true);
	ajax.send(null);
	ajax.onreadystatechange = function()
	{
		if(ajax.readyState == 4)
		{
			document.getElementById('div').innerHTML = ajax.responseText;
		}
}
}
</script>



